package org.etlt.expression.function;

/**
 * system default functions for set
 *
 * @version 2.0
 */
public class SetFunctions {

    @FunctionEnabled(value = "join", help = "for given two values, if they are equal, get one of them. else return null")
    public Object join(Object arg0, Object arg1) {
        if (arg0 != null && arg0.equals(arg1))
            return arg0;
        return null;
    }

    @FunctionEnabled(value = "left_join", help = "for given two values, join them, or if one is null, return the other")
    public Object leftJoin(Object arg0, Object arg1) {
        if (arg0 == null)
            return arg1;
        if (arg1 == null)
            return arg0;
        return join(arg0, arg1);
    }

}
